package com.isias.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.isias.model.system.SysPost;
import com.isias.model.vo.SysPostQueryVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SysPostMapper extends BaseMapper<SysPost> {
    IPage<SysPost> selectPage(Page<SysPost> page, @Param("vo") SysPostQueryVo sysPostQueryVo);

    @Update("update sys_post set status=#{status} where id=#{id} and is_deleted = 0")
    Boolean changeStatus(String id,Integer status);

    @Select("select name from sys_post where is_deleted=0 and id=#{postId}")
    String selectNameById(String postId);
    @Select("select id,name from sys_post where is_deleted=0")
    List<SysPost> selectIdAndPostName();
}
